|
|
|
|
|
|
|
Figure 12.1
Program Show2D. |
|
|
|
|
|
|
|
|
You can think of a picture as existing in its own coordinate space. This is some abstract place that has boundaries that make sense for the particular picture. For example, suppose you want to graph stock prices over a 12-month period when the stock had values ranging from $10 to $30 per share. You can work in a coordinate space with 1 <= x <= 12 and 10 <= y <= 30. This space is called world coordinate space or global coordinate space. You specify points in this space using world or global coordinates. |
|
|
|
|
|
|
|
|
Often, you will not want to display the entire picture drawn in the world coordinate space. You may want to zoom in and display only a small part of the picture, or you may want to zoom out to display the picture at a smaller scale. In traditional graphics programming terms, the region of world coordinate space that you want to display is called a window. Unfortunately, the word ''window" has been overused in recent years, so this can be confusing. This book uses the term world window to mean the area in world coordinate space that you want to display. |
|
|
|
|
|
|
|
|
Once you know what you want to display, you need to decide where on the computer's screen to display it. This screen area is traditionally called a viewport. The relationship between a world window and viewport is shown in Figure 12.2. |
|
|
|
|
|
|
|
|
The size and position of the world window determine which part of the picture is drawn. The relative sizes of the world window and the viewport determine the scale at which the picture is displayed on the screen. For a given viewport, a relatively large world window produces a small picture because you are drawing a large piece of world coordinate space into a small viewport. A relatively small world window produces a |
|
|
|
|
|